package tShareLife.facebook;


public class FbUtil {
//
//	// Your Facebook Application ID must be set before running this example
//	// See http://www.facebook.com/developers/createapp.php
//	public static final String APP_ID = "187466994621698";
//	private Activity cxt;
//
//	private Facebook mFacebook;
//	private AsyncFacebookRunner mAsyncRunner;
//
//	/** Called when the mainPage is first created. */
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//		if (APP_ID == null) {
//			Util.showAlert(cxt, "Warning", "Facebook Applicaton ID must be " + "specified before running this example: see Example.java");
//		}
//
//		mFacebook = new Facebook(APP_ID);
//		mAsyncRunner = new AsyncFacebookRunner(mFacebook);
//
//		SessionStore.restore(mFacebook, cxt);
//		SessionEvents.addAuthListener(new SampleAuthListener());
//		SessionEvents.addLogoutListener(new SampleLogoutListener());
//		
//		if (mFacebook.isSessionValid()) {
//			SessionEvents.onLogoutBegin();
//			AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFacebook);
////			asyncRunner.logout(cxt, new LogoutRequestListener());
//		} else {
//			mFacebook.authorize(cxt, new String[] {}, new LoginDialogListener());
//		}
//		
//		mRequestButton.setOnClickListener(new OnClickListener() {
//			public void onClick(View v) {
//				mAsyncRunner.request("me", new SampleRequestListener());
//			}
//		});
//		mRequestButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE);
//	}
//
//	@Override
//	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//		mFacebook.authorizeCallback(requestCode, resultCode, data);
//	}
//
//	public class SampleAuthListener implements AuthListener {
//
//		public void onAuthSucceed() {
//			mRequestButton.setVisibility(View.VISIBLE);
//		}
//
//		public void onAuthFail(String error) {
//		}
//	}
//
//	public class SampleLogoutListener implements LogoutListener {
//		public void onLogoutBegin() {
//		}
//
//		public void onLogoutFinish() {
//			mRequestButton.setVisibility(View.INVISIBLE);
//		}
//	}
//
//	public class SampleRequestListener extends BaseRequestListener {
//
//		public void onComplete(final String response, final Object state) {
//			try {
//				// process the response here: executed in background thread
//				Log.d("Facebook-Example", "Response: " + response.toString());
//				JSONObject json = Util.parseJson(response);
//				final String contactsName = json.getString("contactsName");
//
//				// then post the processed result back to the UI thread
//				// if we do not do this, an runtime exception will be generated
//				// e.g. "CalledFromWrongThreadException: Only the original
//				// thread that created a view hierarchy can touch its views."
//				cxt.runOnUiThread(new Runnable() {
//					public void run() {
//
//					}
//				});
//			} catch (JSONException e) {
//				Log.w("Facebook-Example", "JSON Error in response");
//			} catch (FacebookError e) {
//				Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
//			}
//		}
//	}
//
//	private final class LoginDialogListener implements DialogListener {
//		public void onComplete(Bundle values) {
//			SessionEvents.onLoginSuccess();
//		}
//	
//		public void onFacebookError(FacebookError error) {
//			SessionEvents.onLoginError(error.getMessage());
//		}
//	
//		public void onError(DialogError error) {
//			SessionEvents.onLoginError(error.getMessage());
//		}
//	
//		public void onCancel() {
//			SessionEvents.onLoginError("Action Canceled");
//		}
//	}

}
